import { ILoadMapTypeAll } from '@/common';
import { getLevelZeroJson, getTenantID } from '@/utils';
import { PlanManageAPI } from '../common/type';

const ManageSearchColumns = (loadMdicMapList: Record<string, any>): PlanManageAPI.ISearchList => {
  /** 采购类别 */
  const purchaseData = loadMdicMapList[`${getTenantID()}${ILoadMapTypeAll.PURCHASE_CATEGORY}`];

  return [
    {
      name: 'supplyWay',
      placeholder: '计划类别',
      label: '计划类别',
      componentType: 'Select',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      dataSource: [
        { name: '月度计划', id: '0', value: '0' },
        // { name: '零星采购', id: '1', value: '1' },
        // { name: '实验平台', id: '2', value: '3' },
      ],
    },
    {
      name: 'planName',
      placeholder: '计划名称',
      label: '计划名称',
      componentType: 'Input',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'expectSum',
      placeholder: '预估总价',
      label: '预估总价',
      componentType: 'NumberRange',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'state',
      placeholder: '计划状态',
      label: '计划状态',
      componentType: 'Select',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      dataSource: [
        { name: '待执行', id: '0', value: '0' },
        { name: '执行中', id: '1', value: '1' },
        { name: '已完成', id: '2', value: '2' },
      ],
    },
    // ===============================高级搜索===================================
    {
      name: 'createTime',
      placeholder: '',
      label: '创建时间',
      componentType: 'RangePicker',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: true,
    },
    {
      name: 'createFormName',
      placeholder: '创建',
      label: '创建',
      componentType: 'DeptAndUser',
      dataSource: getLevelZeroJson() ?? [],
      allowClear: true,
      md: 8,
      sm: 24,
      whetherSenior: true, //是否放到更多搜索里面
      formOrgType: {
        COMP: 'createCompanyID',
        DEPT: 'createDepartmentID',
        POS: 'createPositionID',
        USER: 'createrID',
      },
    },
  ];
};

export { ManageSearchColumns };
